package com.kc.web.controller.business;

import com.kc.business.domain.BizMarketEnterForm;
import com.kc.business.service.IBizMarketEnterService;
import com.kc.common.annotation.Log;
import com.kc.common.annotation.RepeatSubmit;
import com.kc.common.core.controller.BaseController;
import com.kc.common.core.domain.AjaxResult;
import com.kc.common.core.page.TableDataInfo;
import com.kc.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * TODO
 *
 * @author zhangshuo
 * @version 1.0
 * @date 2020/9/25
 */
@RestController
@RequestMapping("/business/marketEnter")
public class BizMarketEnterContorller extends BaseController {

    @Autowired
    private IBizMarketEnterService marketEnterService;

    /**
     * 获取市场入驻列表
     */
    @PreAuthorize("@ss.hasPermi('business:marketEnter:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizMarketEnterForm marketEnterForm) {
        startPage();
        List<BizMarketEnterForm> list = marketEnterService.getList(marketEnterForm);
        return getDataTable(list);
    }

    /**
     * 新增市场入驻
     */
    @PreAuthorize("@ss.hasPermi('business:marketEnter:edit')")
    @Log(title = "市场入驻管理", businessType = BusinessType.UPDATE)
    @PutMapping
    @RepeatSubmit
    public AjaxResult edit(@RequestBody BizMarketEnterForm marketEnterForm) {
        return toAjax(marketEnterService.edit(marketEnterForm));
    }
}
